home *** CD-ROM | disk | FTP | other *** search
-
-
-
- MMMMAAAALLLLLLLLOOOOCCCC((((3333FFFF)))) MMMMAAAALLLLLLLLOOOOCCCC((((3333FFFF))))
-
-
-
- NNNNAAAAMMMMEEEE
- malloc, free - main memory allocator
-
- FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ppppooooiiiinnnntttteeeerrrr ((((iiiippppttttrrrr,,,, aaaarrrrrrrr))))
- ddddiiiimmmmeeeennnnssssiiiioooonnnn aaaarrrrrrrr((((1111))))
- iiiinnnntttteeeeggggeeeerrrr nnnnbbbbyyyytttteeeessss
-
- iiiippppttttrrrr ==== mmmmaaaalllllllloooocccc((((nnnnbbbbyyyytttteeeessss))))
-
- ccccaaaallllllll ffffrrrreeeeeeee((((iiiippppttttrrrr))))
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _m_a_l_l_o_c and _f_r_e_e provide a simple general-purpose memory allocation
- package. _m_a_l_l_o_c returns a pointer to a block of at least _n_b_y_t_e_s bytes
- suitably aligned for any use.
-
- _a_r_r can be an array of any type. After the call to _m_a_l_l_o_c the array _a_r_r
- can be used as if it has been declared as an array with _n_b_y_t_e_s in length.
- All references to this array will be deferenced using the value assigned
- to _i_p_t_r in the _m_a_l_l_o_c call to refer to the space allocated by _m_a_l_l_o_c.
-
- The argument to _f_r_e_e is a pointer to a block previously allocated by
- _m_a_l_l_o_c; after _f_r_e_e is performed this space is made available for further
- allocation, but its contents are left undisturbed.
-
- Undefined results will occur if the space assigned by _m_a_l_l_o_c is overrun
- or if some random number is handed to _f_r_e_e.
-
- _m_a_l_l_o_c allocates the first big enough contiguous reach of free space
- found in a circular search from the last block allocated or freed,
- coalescing adjacent free blocks as it searches. It calls _s_b_r_k [see
- _b_r_k(2)] to get more memory from the system when there is no suitable
- space already free.
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- _m_a_l_l_o_c, returns a NULL pointer if there is no available memory or if the
- arena has been detectably corrupted by storing outside the bounds of a
- block. When this happens the block pointed to by _i_p_t_r may be destroyed.
-
- NNNNOOOOTTTTEEEESSSS
- Search time increases when many objects have been allocated; that is, if
- a program allocates but never frees, then each successive allocation
- takes longer.
-
- Note that the system may be configured with virtual swap space. This
- allows processes to allocate more virtual memory than is actually
- available, allowing the use of sparse addressing, successful forks and
- subsequent execs by programs larger than 1/2 the available virtual
- memory, and so forth. Thus programs using malloc may get a successful
- return, but later be sent the SIGKILL signal if virtual memory was
- overcommitted, and processes attempt to actually use all of the
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- MMMMAAAALLLLLLLLOOOOCCCC((((3333FFFF)))) MMMMAAAALLLLLLLLOOOOCCCC((((3333FFFF))))
-
-
-
- overcommitted memory. If the system has no virtual swap space
- configured, then processes are limited to using no more virtual memory
- than the sum of physical memory and swap space. See the section on
- "Logical Swap Space" in the swap(1M) man page for more information.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-